/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ambimmort.ucagent.modules.webservice;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONObject;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

import com.ambimmort.ucagent.appframework.Module;
import java.net.InetAddress;

/**
 *
 * @author 定巍
 */
public class WebServiceModule extends Module {

    private Server server = null;


    public WebServiceModule() {

    }

    @Override
    public String getName() {
        return "WebServiceComponent";
    }

    @Override
    protected void poststart() throws Throwable {
        InetAddress addr = InetAddress.getLocalHost();
        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        factory.setServiceClass(WebServiceBean.class);
        factory.setServiceBean(new WebServiceBeanImpl());
        factory.setAddress("http://" + addr.getHostAddress() + ":9003");
        Server server = factory.create();
        server.start();
    }

}
